import Vue    from 'vue';
import Router from 'vue-router';

Vue.use(Router)

import Home from './home';
import Classify from './classify';
import Shopping from './shopping';
import Personal from './personal';
import Login from './login';
import H5 from './h5';

const $router = new Router({
	routes: [].concat(
		Home,
		Classify,
		Shopping,
		Personal,
		Login,
		H5
	)
})

// Before router
$router.beforeEach((to, form, next) => {
	next();

})

// After router
$router.afterEach(route => {
	if(route.query.navName)
		document.title = route.query.navName;
	else
		document.title = route.meta.title;
})

export default $router;